//
//  SafetyDeskManager.m
//  gdemm
//
//  Created by 徐辉 on 2017/4/26.
//  Copyright © 2017年 Goldencis. All rights reserved.
//

#import "SafetyDeskManager.h"
#import "PackagesChecker.h"
#import "PackageInfo.h"

@interface SafetyDeskManager()



@end


@implementation SafetyDeskManager


- (NSArray *)getDesktoPApps{
    
    NSMutableArray *apps = [[PackagesChecker getInstance] getAllAppsFromDevice];
    NSMutableArray *appsTemp = [NSMutableArray arrayWithArray:apps];
    HRLog(@"appsTemp = %@",appsTemp);
    NSString *appsStr = [[UserDefaultsUtil shareInstance]getString:LC_DESKTOPAPPS];
    NSArray *appsArr = [appsStr componentsSeparatedByString:@";"];
    for (PackageInfo *packInfo in apps) {
        NSString *softName = packInfo.softName;
        for (int i = 0; i < appsArr.count; i++) {
            if ([softName isEqualToString:appsArr[i]]) {
                break;
            }
            
            if (i == (appsArr.count - 1)) {
                [appsTemp removeObject:packInfo];
            }
        }
        
    }
    HRLog(@"appsArr = %@ appsTemp = %@",appsArr,appsTemp);
    return appsTemp;

}
@end
